package test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.*;
public class TrySQL {
	public static void main(String[] args) {

	String javaclass="com.microsoft.sqlserver.jdbc.SQLServerDriver";
		String jdbcurl="jdbc:sqlserver://localhost:1434;databasename=demo";
		String sql="insert into info values('okk','kkk')";
		ResultSet rs;
		PreparedStatement ps;		
		Statement stmt; 
		Connection conn= null;
		try{
			//��ݿ������⣬������Ӳ���ok什么，会卡住
			Class.forName(javaclass).newInstance();		
			conn=DriverManager.getConnection(jdbcurl,"test","123456");			
			//ps=conn.prepareStatement(sql);
			stmt = conn.createStatement();
			//rs=ps.executeQuery();
			System.out.println(conn.toString());
			//ps.execute();
			System.out.println("�ɹ�");
			System.out.println("什么情况");
			stmt.executeUpdate(sql);
			System.out.println("�ɹ�");
//			while(rs.next()){
//				int a=rs.getInt(1);
//				System.out.println(a);
//				System.out.println(rs.getString(2));
//			}
			//conn.commit();
			System.out.println("two");
			stmt.close();
			conn.close();
		}catch(Exception ex)	{
			//System.out.println("nono");
			ex.printStackTrace();
		}
		finally{
			//if(rs!=null)
				//rs.close();			
		}
	}
	
	
}
